package com.xxl.job.executor.config.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 通过注解实现监听器，监听 ContextRefreshedEvent
 */

@Slf4j
@Component
public class LearnApplicationListener implements ApplicationListener<ContextRefreshedEvent> {

  @EventListener(ContextRefreshedEvent.class)
  @Order(100)
  public void onApplicationEvent2(ContextRefreshedEvent event) {
    log.info("100[注解]===监听器启动！");
  }

  @Override
  @Order(101)
  public void onApplicationEvent(ContextRefreshedEvent event) {
    log.info("101[接口]===监听器启动！");
  }
}
